
GoTo(@Banking)

@MainLoop:
OnCoordsChanged(@Moved,%LX,%LY)
OnTimer(@Moved,1,3000)
@Loopy:
ResetLastServerMessage()
Withdraw(40,1)
Wait(3)
Magic(28)
Deposit(40,1)
Wait(7,8,9)
GoToIfInLastServerMessageIsNot(@NoLongWait,"The spell fails")
Wait(170)
@NoLongWait:
SetVarFatigue(%v)
GoToIfVarAboveNum(@GetSomeSleep,%v,700)

GoTo(@Loopy)




@Banking:
ResetQuestMenu()
SetVarNum(%banks,0)
ResetLastServerMessage()
SetVarsRandomNPCIn(%x,%y,%ID,106,510,98,515,95)
GoToIfVarEqualNum(@Dead,%ID,-1)
ActionVarVar(%x,%y)
TalkToNPCVar(%ID)
ResetQuestMenu()
WaitForQuestMenu(15)
GoToIfLastServerMessageIs(@Banking,"Banker is busy at the moment")
GoToIfQuestMenu(@ContactWithBanker)
ResetQuestMenu()
WaitForQuestMenu(15)
GoToIfLastServerMessageIs(@Banking,"Banker is busy at the moment")
GoToIfQuestMenu(@ContactWithBanker)
ResetQuestMenu()
WaitForQuestMenu(15)
GoToIfLastServerMessageIs(@Banking,"Banker is busy at the moment")
GoToIfQuestMenu(@ContactWithBanker)
GoTo(@Banking)

@ContactWithBanker:
Answer(0)
WaitForBankWindow(50)
Wait(5)
DepositEverything()
Wait(10)
GoTo(@MainLoop)



@Moved:
EnableEvents()
Debug("Looking again for banker")
GoTo(@Banking)




@GetSomeSleep:
OnTimer(-1,1,3000)
CloseBank()
Wait(20)
SetVarNum(%runs,0)
UseItem(0)
ResetLastServerMessage()
SetVarNum(%secs,0)
@JustWait:
Wait(10)
AddVarNum(%secs,1)
GoToIfVarAboveNum(@GetSomeSleep,%secs,70)
GoToIfLastServerMessageIsNot(@JustWait,"You wake up - feeling refreshed")
SetVarNum(%secs,0)
GoTo(@Banking)




@Dead:
StopAndLogOut()

